home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
429_01
/
chess12
/
uplayer.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-30
|
576b
|
28 lines
#include "chess.hpp"
#include "uplayer.hpp"
#include "chessui.hpp"
GAMESTATUS USERPLAYER::play(BOARD &board) const
{
BOARDMETRIC metric;
board.findBestMoves(2, whatColor(), metric, (BESTMOVES *) 0);
switch (metric.kingSituation[whatColor()])
{
case KINGLOST:
ChessUI.mated(whatColor());
return(GAMEOVER);
case STALEMATE:
ChessUI.staleMated(whatColor());
return(GAMEOVER);
case KINGOK:
break;
}
if (!ChessUI.userMove(board, whatColor()))
return(GAMEOVER);
return(GAMECONTINUE);
}